/**
 * @file Define the default controller
 * 
 * @author Steve Gao<gaofu@parllay.com>
 */
const WebBaseController = require('./web-base-controller');
const {SystemServices}  = require('../../constants');

/**
 * The class DefaultController
 * 
 * @description 
 * 
 * @class DefaultController
 * @extends {BaseController}
 */
class DefaultController extends WebBaseController {
    
    get wallService() {
        if (!this._wallService) {
            this._wallService = this.getSystemService(SystemServices.WALL_SERVICE);
        }

        return this._wallService;
    }

    get name() {
        return 'DefaultController';
    }

    get handlersPath() {
        return 'default';
    }

    getTVAppUpdateInfo() {
        return this.Context.getTVAppUpdateInfo();
    }

    /**
     * Upgrade user's plan data, this is an administration task, need move to administration controller
     * 
     * @name upgradePlanData
     * @param {Function} parentCallback - the callaback function 
     * 
     * @returns {void}
     */
    upgradePlanData(parentCallback) {
        this.wallService.upgradePlanData((message) => {
            parentCallback(message);
        });
    }
}

exports.DefaultController = DefaultController;